﻿@page "/materials"
@inject ToastService ToastService
@inject IWebHostEnvironment even
@inject NavigationManager nav

@attribute [TabItemOption(Text = "材料列表", Closable = true)]

<div style="height:80vh">
    <Table TItem="Material"
           ShowFooter="true"
           IsFixedFooter="true"
           IsMultipleSelect="true"
           AllowResizing="true"
           IsBordered="true"
           IsFixedHeader="true"
           AutoGenerateColumns="true"
           ShowToolbar="true"
           IsPagination="true">

        <TableColumns>
            <TableColumn @bind-Field="@context.Image" Text="贴图" Order="3">

                <Template Context="value">
                    <div>
                        <img src="@value.Row.Image.Url" />
                    </div>
                </Template>

                <EditTemplate Context="v">

                    <div class="col-12 col-sm-6 col-md-6">
                        <label class="form-label">图片</label>
                        <ImageComponent @bind-Image="@v.Image"></ImageComponent>
                    </div>

                </EditTemplate>

            </TableColumn>

            <TableColumn @bind-Field="@context.Price" Text="单价">

                <EditTemplate Context="v">
                    <div class="col-12 col-sm-6 col-md-6">
                        <BootstrapInputNumber @bind-Value="@v.Price" Step="0.001" DisplayText="单价"></BootstrapInputNumber>
                    </div>
                </EditTemplate>

            </TableColumn>
        </TableColumns>

    </Table>
</div>

@code {
    protected override Task OnInitializedAsync()
    {

        return base.OnInitializedAsync();
    }


}
